package com.andrew.demo.mapper;

import com.andrew.demo.tableInfo.BaseTableInfoEntity;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

public class BaseMapper<T> implements RowMapper<T> {

    public BaseTableInfoEntity TableInfoEntity;

    public BaseMapper(BaseTableInfoEntity tableInfoEntity) {
        TableInfoEntity = tableInfoEntity;
    }

    public T convert(ResultSet rs) throws SQLException {
        return (T) TableInfoEntity.convert(rs);
    }

    @Override
    public T mapRow(ResultSet rs, int rowNum) throws SQLException {
        return convert(rs);
    }


}